package test.ui {
	import gear.core.Game;
	import gear.net.LibData;
	import gear.net.RESManager;
	import gear.net.SWFLoader;
	import gear.ui.controls.GSlider;
	import gear.ui.data.GSliderData;
	import gear.ui.model.RangeModel;

	import flash.events.Event;

	/**
	 * 测试滑块控件
	 * 
	 * @author bright
	 * @version 20101022
	 */
	[SWF(width=550,height=400,backgroundColor=0x333333,frameRate=48)]
	public class TestGSlider extends Game {
		override protected function startup() : void {
			RESManager.instance.add(new SWFLoader(new LibData("assets/ui.swf")));
			RESManager.instance.addEventListener(Event.COMPLETE, completeHandler);
			RESManager.instance.load();
		}

		private function completeHandler(event : Event) : void {
			var data : GSliderData = new GSliderData();
			var slider : GSlider = new GSlider(data);
			slider.direction = GSlider.VERTICAL;
			slider.moveTo(100, 100);
			slider.model.addEventListener(Event.CHANGE, slider_changeHandler);
			addChild(slider);
		}

		private function slider_changeHandler(event : Event) : void {
			trace(RangeModel(event.target).value);
		}

		public function TestGSlider() {
			super();
		}
	}
}
